<?php
require 'libs/Smarty.class.php';
include 'includes/dbclass.php';
include 'config.php';
$smarty = new Smarty;
$smarty->compile_check = true;
//$smarty->force_compile = true;

$db = new db($dbhost, $dbuser, $dbpass, $dbname);
$res_config = $db->query("SELECT * FROM config");
if (mysql_num_rows($res_config) == 0)
	die("Couldn't get the config from the database");
$config = mysql_fetch_assoc($res_config);

$res_funcs = $db->query("SELECT func_name FROM functions");
$i = 0;
while ($row = mysql_fetch_assoc($res_funcs))
{
	$functions[$i]['name'] = '<a href="code.php?function=' . $row['func_name'] . '">' . $row['func_name'] . '</a>';
	++$i;
}

$smarty->assign("project", $config['proj_name']);
$smarty->assign("copyright", $config['copyright']);
$smarty->assign("last_update", date("D, d M Y", $config['index_last_update']));
$smarty->assign("logo", "images/logo2.gif");
$smarty->assign("functions", $functions);

$smarty->display('index.tpl');
?>